package edu.gmu.atelier.generic;

import edu.gmu.atelier.Epsilon;
import edu.gmu.atelier.generic.Vector;

/**
 * Set of vectors with vector combination and scalar multiplication operations.
 * @author James H. Pope
 */
public interface Matrix <T extends Vector>
{
    /**
     * Gets the number of columns of the matrix.
     * @return 
     */
    public int getCols();
    
    /**
     * Gets the number of rows of the matrix.
     * @return 
     */
    public int getRows();
    
    /**
     * Multiplies the vector x by this matrix. Stated differently, linear
     * mapping f: R^n -> R^m. 
     * @param x
     * @return b = Ax
     */
    public T mult(T x);
    
    /**
     * Multiplies each vector of b by this matrix to produce b.cols vectors.
     * Note that this is a right-multiply, the resulting matrix with
     * a.rows x b.cols.
     * @param b
     * @return a*b
     */
    public Matrix<T> mult(Matrix<T> b);
    
    /**
     * Multiplies each element in this matrix by the scalar.
     * @param scalar
     * @return sA
     */
    //public Matrix mult(double scalar);
    
    /**
     * Gets the vector at the specified column position.
     * @param colPos
     * @return vector at colPos
     */
    public T getVector(int j);
    
    /**
     * Transposes the matrix such that rows become cols and cols become rows.
     * @return a^T
     */
    public Matrix<T> transpose();
    
    /**
     * Determines whether or not two matrices are similar within some given
     * tolerance defined by e.  This may not be desirable because math
     * becomes erroneous, e.g. A similar to B but AC != BC because round
     * off errors.
     * <p>
     * If e is null then the method is to behave as
     * the object equals method requiring exact equality.
     * @param obj
     * @param e
     * @return 
     */
    public boolean similar( Object obj, Epsilon e );
}
